POV-Ray : Newsgroups : povray.beta-test : Create_Ini bug : Re: Create_Ini bug Server Time
30 Jul 2024 02:29:08 EDT (-0400)
  Re: Create_Ini bug  
From: Anders K 
Date: 10 Mar 2002 19:41:55
Message: <3c8bfd53@news.povray.org>
> And maybe I missed something, but how many non-computer programming uses
of
> zero-based counting are there?

Several. For example, one of my recent POV-Ray projects was rendering a set
of 720 tiles which get assembled into a 36x20 bitmap. To simplify this, I
used animation to make a set of bitmaps called tile000.bmp through
tile719.bmp, and I wrote a program that adds each tile bitmap to the master
bitmap. The formula that it uses to calculate where each tile goes is pretty
simple:
  x = n mod 36
  y = int(n / 36)
Where n is the zero-based tile number, x is the zero-based row number in the
master bitmap, and y is the zero-based column number in the master bitmap.

Now, If I had used one-based counting for everything instead, the formula
would have looked more like this:
  x = ((n - 1) mod 36) + 1
  y = int((n + (36 - 1)) / 36)
You say one-based counting would avoid many bugs, but which formula do you
think would be more likely to have bugs in it?

Please remember that I'm not asking you to change anything, only to leave it
the way it is! The current behavior is fine for both one-based and
zero-based counting, so what's the problem?

Anders

--
light_source{6#local D=#macro B(E)#macro A(D)#declare E=(E-#declare
C=mod(E D);C)/D;C#end#while(E)#if(A(8)=7)#declare D=D+2.8;#else#if(
C>2)}torus{1..2clipped_by{box{-2y}}rotate<1 0C>*90translate<D+1A(2)
*2+1#else}cylinder{0(C-v=1).2translate<D+C*A(2)A(4)#end-2 13>finish
{specular 1}pigment{rgb x}#end#end#end-8;1B(445000298)B(519053970)B
(483402386)B(1445571258)B(77778740)B(541684549)B(42677491)B(70)}


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.